Electron: From Beginner to Pro by Chris Griffith & Leif Wells

Electron: From Beginner to Pro by Chris Griffith & Leif Wells

Author:Chris Griffith & Leif Wells
Language: eng
Format: epub
Publisher: Apress, Berkeley, CA
Published: 2017-11-24T16:00:00+00:00


This code waits half a second (that is what the 500 argument represents in milliseconds for setTimeout()), and then calls the same function as before to capture the window image. Give it a try to see your results (Figure 8-13).

Figure 8-13.Captured image of the window without the button down state

Alright! That is more like it! Great job!

The printToPDF Method

Like the capturePage method, the WebContents’ printToPDF method can be equally helpful. It is basically the same setup as the capturePage exercise. Let’s get started.

Open your index.html file and add the following code in bold to add a second button:

<body>

<h1>Hello World!</h1>

<!-- All of the Node.js APIs are available in this renderer process. -->

We are using Node.js <script>document.write(process.versions.node)</script>,

Chromium <script>document.write(process.versions.chrome)</script>,

and Electron <script>document.write(process.versions.electron)</script>.

<div>



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.